

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.logging.Logger;

public class L4JOS extends OutputStream {
	private String className;

	public L4JOS() {
	}

	public L4JOS(String className) {
		this.className = className;
	}

	Logger logger = Logger.getLogger(getClassName());
	private int lineEnd = (int) '\n';
	private ByteArrayOutputStream baos = new ByteArrayOutputStream();

	public void write(int b) throws IOException {
		baos.write(b);
		if (b == lineEnd) {
			logger.info(baos.toString());
			baos.reset();
		}
	}

	public String getClassName() {
		if (this.className == null)
			this.className = L4JOS.class.getCanonicalName();
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}
}